package com.ikapp.jetpackcomposeuidemo.weiget

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Card
import androidx.compose.material3.CardElevation
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp

/**
 *  ANDROID STUDIO - VERSION 2022
 *  createTime: 2023/11/17 23:01
 *  Author: Ikun
 *  email: jikunwei41@gmail.com
 **/

@Composable
@Preview
fun CardShow() {
    CardLayout(modifier = Modifier)
}


/**
 * Card 卡片布局
 */
@Composable
fun CardLayout(
    modifier: Modifier = Modifier
) {
    Card(
        modifier = modifier
            .fillMaxWidth()
            .padding(15.dp)
            .clickable { /** 点击波纹 **/ },
        // elevation = 10.dp 设置阴影
    ) {
        Column(
            modifier = Modifier.padding(15.dp)
        ) {
            Text(
                buildAnnotatedString {
                    append("欢迎来到")
                    withStyle(style = SpanStyle(fontWeight = FontWeight.W900, color = Color(0xFF44552b))) {
                        append("compose课堂")
                    }
                }
            )

            Text(
                buildAnnotatedString {
                    append("你现在观看的章节是")
                    withStyle(style = SpanStyle(fontWeight = FontWeight.W900, color = Color(0xFF44552b))) {
                        append("Card")
                    }
                }
            )
        }
    }
}
